import type { GetCodeData, GetCodeParams, LoginCodeData, LoginCodeParams, UserData } from "@/types/user"
import { request } from "@/utils/request"

// 1. 发送验证码接口
export const getCodeApi = (params: GetCodeParams) => {
  // get 方法的参数需要通过 params 来传递
  return request.get<null, GetCodeData>('/code', { params })
}

// 2. 登录接口
export const loginCodeApi = (data:LoginCodeParams) => {
  return request.post<null, LoginCodeData>('/login', data)
}

// 3. 获取用户信息接口
export const getUserInfo = () => {
  return request.get<null, UserData>('/patient/myUser')
}